var _tools = require("../../../utils/tools.js"), _tools2 = _interopRequireDefault(_tools);

function _interopRequireDefault(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

var that, app = getApp();
let interstitialAd = null;

Page({
    data: {
        id: 0,
        indicatorDots: !1,
        vertical: !1,
        autoplay: !0,
        interval: 5e3,
        duration: 1e3,
        isScrollY: !0,
        current: 0,
        isIphoneX: !1,
        isIphone: !1,
        extra_info_tab: 1,
        p: 1,
        isover: !1
    },
    onLoad: function() {
        that = this;
    },
    onReady: function() {
        that.loadContent(), wx.setNavigationBarColor({
            frontColor: "#000000",
            backgroundColor: "#000000"
        });
    },
    onUnload: function() {
        if (wx.createInterstitialAd) {
            interstitialAd = wx.createInterstitialAd({
              adUnitId: 'adunit-42e141bfcfdcc315'
            })
            interstitialAd.onLoad(() => {})
            interstitialAd.onError((err) => {})
            interstitialAd.onClose(() => {})
          };
          
          // 在适合的场景显示插屏广告
          if (interstitialAd) {
            interstitialAd.show().catch((err) => {
              console.error(err)
            })
          };
    },
    onHide: function() {},
    onReachBottom: function() {
        this.data.isover || (this.data.p += 1, that.loadContent());
    },
    loadContent: function() {
        var t = {
            action: "log",
            contr: "sign",
            token: wx.getStorageSync("token"),
            p: that.data.p
        };
        _tools2.default.request(t, function(t) {
            var a = t.info.log;
            1 < that.data.p && (a = that.data.log.concat(a)), that.setData({
                log: a
            }), t.info.log.length < 10 && that.setData({
                isover: !0
            });
        });
    },
    onShow: function() {},
    onShareAppMessage: function() {
        return {
            title: this.data.share.text,
            imageUrl: this.data.share.images,
            path: "bh_bargain/pages/index/index?parent_id=" + this.data.share.member_id
        };
    }
});